package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class CartInfo {

	private long addTime;
	private int canHandsel;
	private String cookieId;
	private String extensionCode;
	private String goodsAttr;
	private String goodsAttrId;
	private int goodsId;
	private int goodsIntegral;
	private String goodsMemo;
	private String goodsName;
	private int goodsNumber;
	private double goodsPrice;
	private String goodsSn;
	private int goodsStatus;
	private String integralScale;
	private boolean isGift;
	private boolean isReal;
	private double marketPrice;
	private int parentId;
	private String providerCode;
	private int recId;
	private int recType;
	private String sessionId;
	private int suppNumber;
	private int userId;
	private int goodsPrize;
	private String goodsThumb;
	private String goodsImg;
	private double goodsWeight;
	private JSONObject jsonObject;

	public long getAddTime() {

		return addTime;
	}

	public void setAddTime(long addTime) {

		this.addTime = addTime;
	}

	public int getCanHandsel() {

		return canHandsel;
	}

	public void setCanHandsel(int canHandsel) {

		this.canHandsel = canHandsel;
	}

	public String getCookieId() {

		return cookieId;
	}

	public void setCookieId(String cookieId) {
		this.cookieId = cookieId;
	}

	public String getExtensionCode() {

		return extensionCode;
	}

	public void setExtensionCode(String extensionCode) {
		this.extensionCode = extensionCode;
	}

	public String getGoodsAttr() {

		return goodsAttr;
	}

	public void setGoodsAttr(String goodsAttr) {
		this.goodsAttr = goodsAttr;
	}

	public String getGoodsAttrId() {

		return goodsAttrId;
	}

	public void setGoodsAttrId(String goodsAttrId) {
		this.goodsAttrId = goodsAttrId;
	}

	public int getGoodsId() {

		return goodsId;
	}

	public void setGoodsId(int goodsId) {

		this.goodsId = goodsId;
	}

	public int getGoodsIntegral() {

		return goodsIntegral;
	}

	public void setGoodsIntegral(int goodsIntegral) {
		this.goodsIntegral = goodsIntegral;
	}

	public String getGoodsMemo() {

		return goodsMemo;
	}

	public void setGoodsMemo(String goodsMemo) {

		this.goodsMemo = goodsMemo;
	}

	public String getGoodsName() {

		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}

	public int getGoodsNumber() {

		return goodsNumber;
	}

	public void setGoodsNumber(int goodsNumber) {
		this.goodsNumber = goodsNumber;
	}

	public double getGoodsPrice() {

		return goodsPrice;
	}

	public void setGoodsPrice(double goodsPrice) {
		this.goodsPrice = goodsPrice;
	}

	public String getGoodsSn() {

		return goodsSn;
	}

	public void setGoodsSn(String goodsSn) {
		this.goodsSn = goodsSn;
	}

	public int getGoodsStatus() {

		return goodsStatus;
	}

	public void setGoodsStatus(int goodsStatus) {
		this.goodsStatus = goodsStatus;
	}

	public String getIntegralScale() {

		return integralScale;
	}

	public void setIntegralScale(String integralScale) {
		this.integralScale = integralScale;
	}

	public boolean getIsGift() {

		return isGift;

	}

	public void setIsGift(boolean isGift) {
		this.isGift = isGift;
	}

	public boolean getIsReal() {

		return isReal;
	}

	public void setIsReal(boolean isReal) {
		this.isReal = isReal;
	}

	public double getMarketPrice() {

		return marketPrice;
	}

	public void setMarketPrice(double marketPrice) {
		this.marketPrice = marketPrice;
	}

	public int getParentId() {

		return parentId;
	}

	public void setParentId(int parentId) {
		this.parentId = parentId;
	}

	public String getProviderCode() {

		return providerCode;
	}

	public void setProviderCode(String providerCode) {
		this.providerCode = providerCode;
	}

	public int getRecId() {

		return recId;
	}

	public void setRecId(int recId) {
		this.recId = recId;
	}

	public int getRecType() {

		return recType;
	}

	public void setRecType(int recType) {
		this.recType = recType;
	}

	public String getSessionId() {

		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public int getSuppNumber() {

		return suppNumber;
	}

	public void setSuppNumber(int suppNumber) {
		this.suppNumber = suppNumber;
	}

	public int getUserId() {

		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public int getGoodsPrize() {

		return goodsPrize;
	}

	public void setGoodsPrize(int goodsPrize) {
		this.goodsPrize = goodsPrize;
	}

	public String getGoodsThumb() {

		return goodsThumb;
	}

	public void setGoodsThumb(String goodsThumb) {
		this.goodsThumb = goodsThumb;
	}

	public String getGoodsImg() {

		return goodsImg;
	}

	public void setGoodsImg(String goodsImg) {
		this.goodsImg = goodsImg;
	}

	public double getGoodsWeight() {

		return goodsWeight;
	}

	public void setGoodsWeight(double goodsWeight) {
		this.goodsWeight = goodsWeight;
	}

	public String toJsonString() {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("recId", recId);
			jsonObject.put("userId", userId);
			jsonObject.put("sessionId", sessionId);
			jsonObject.put("goodsId", goodsId);
			jsonObject.put("goodsSn", goodsSn);
			jsonObject.put("goodsName", goodsName);
			jsonObject.put("marketPrice", marketPrice);
			jsonObject.put("goodsPrice", goodsPrice);
			jsonObject.put("goodsIntegral", goodsIntegral);
			jsonObject.put("integralScale", integralScale);
			jsonObject.put("goodsNumber", goodsNumber);
			jsonObject.put("goodsAttr", goodsAttr);
			jsonObject.put("goodsPrize", goodsPrize);
			jsonObject.put("goodsMemo", goodsMemo);
			if (isReal) {
				jsonObject.put("isReal", 1);
			} else {
				jsonObject.put("isReal", 0);
			}
			jsonObject.put("extensionCode", extensionCode);
			jsonObject.put("parentId", parentId);
			jsonObject.put("recType", recType);
			if (isGift) {
				jsonObject.put("isGift", 1);
			} else {
				jsonObject.put("isGift", 0);
			}
			jsonObject.put("canHandsel", canHandsel);
			jsonObject.put("goodsAttrId", goodsAttrId);
			jsonObject.put("providerCode", providerCode);
			jsonObject.put("suppNumber", suppNumber);
			jsonObject.put("cookieId", cookieId);
			jsonObject.put("addTime", addTime);
			jsonObject.put("goodsThumb", goodsThumb);
			jsonObject.put("goodsImg", goodsImg);
		} catch (Exception e) {
		}
		return jsonObject.toString();
	}

	public void jsonAnalytic(String jsonString) {
		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
		}
	}

	public void jsonAnalytic(JSONObject jsonObject) {
		this.jsonObject = jsonObject;
		try {
			recId = jsonObject.getInt("recId");
		} catch (JSONException e) {
		}

		try {
			userId = jsonObject.getInt("userId");
		} catch (JSONException e) {

		}
		try {
			sessionId = jsonObject.getString("sessionId");
		} catch (JSONException e) {

		}
		try {
			goodsId = jsonObject.getInt("goodsId");
		} catch (JSONException e) {

		}
		try {
			goodsSn = jsonObject.getString("goodsSn");
		} catch (JSONException e) {

		}
		try {
			goodsName = jsonObject.getString("goodsName");
		} catch (JSONException e) {

		}
		try {
			marketPrice = jsonObject.getDouble("marketPrice");
		} catch (JSONException e) {

		}
		try {
			goodsPrice = jsonObject.getDouble("goodsPrice");
		} catch (JSONException e) {

		}
		try {
			goodsIntegral = jsonObject.getInt("goodsIntegral");
		} catch (JSONException e) {

		}
		try {
			integralScale = jsonObject.getString("integralScale");
		} catch (JSONException e) {

		}
		try {
			goodsNumber = jsonObject.getInt("goodsNumber");
		} catch (JSONException e) {

		}
		try {
			goodsAttr = jsonObject.getString("goodsAttr");
		} catch (JSONException e) {

		}
		try {
			goodsPrize = jsonObject.getInt("goodsPrize");
		} catch (JSONException e) {

		}
		try {
			goodsMemo = jsonObject.getString("goodsMemo");
		} catch (JSONException e) {

		}
		try {
			goodsImg = jsonObject.getString("goodsImg");
		} catch (JSONException e) {

		}
//		try {
//			if (!jsonObject.getString("isReal").equals("")
//					&& jsonObject.getString("isReal").equals("1")) {
//				isReal = true;
//				extensionCode = jsonObject.getString("extensionCode");
//				recType = jsonObject.getInt("recType");
//				if (!jsonObject.getString("isGift").equals("")
//						&& jsonObject.getString("isGift").equals("1")) {
//					isGift = true;
//				}
//				canHandsel = jsonObject.getInt("canHandsel");
//				goodsAttrId = jsonObject.getString("goodsAttrId");
//				providerCode = jsonObject.getString("providerCode");
//				suppNumber = jsonObject.getInt("suppNumber");
//				cookieId = jsonObject.getString("cookieId");
//				addTime = jsonObject.getLong("addTime");
//				goodsStatus = jsonObject.getInt("goodsStatus");
//				goodsThumb = jsonObject.getString("goodsThumb");
//				goodsImg = jsonObject.getString("goodsImg");
//				goodsWeight = jsonObject.getDouble("goodsWeight");
//
//			}
//		} catch (JSONException e) {
//
//			e.printStackTrace();
//		}

	}
}
